#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int pow(int x, int a);

int main()
{
    int N, M;
    bool f = false;
    cin >> N >> M;
    int ans = pow(10, N);
    int count = ans - 1;
    int min = pow(10, N - 1);
    vector<int> s(M), c(M);
    for (int i = count; i >= min; i--)
    {
        for (int j = 0; j < M; j++)
        {
            int div = pow(10, s.at(j) - 1);
            if (count / div != c.at(j))
            {
                break;
            }
            if (j == M - 1 && ans >= i)
            {
                f = true;
                ans = i;
            }
        }
    }
    if (f)
    {
        cout << ans << endl;
    }
    else
    {
        cout << "-1" << endl;
    }
}

int pow(int x, int a)
{
    if (a == 0)
    {
        return 1;
    }
    return x * f(x, a - 1);
}