SP12810 MULTII - Yet Another Multiple Problem

Description

Given a positive integer **N** (1

Input Format

Each test case contains two lines. The first line contains two integers **N** and _m_ separated by a single space. The second line contains _m_ digits separated by spaces. Input terminates by EOF.

Output Format

For each test case output its case number (starting from 1) and the answer in a single line, or "-1" (without quotes) if the answer doesn't exist.