#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int>> num(N, vector<int>(2));
  for (int i = 0; i < N; i++) {
    num.at(i).at(0) = 0;
    num.at(i).at(1) = 0;
  }
  bool ans = true;
  for (int i = 0; i < M; i++) {
    int s, c;
    if (num.at(s).at(c) != 0) ans = false;
    num.at(s).at(0) = c;
    num.at(s).at(1) = 1;
  }
  int x = 0;
  if (ans) {
    for (int i = 0; i < N; i++) {
      x *= 10;
      x += num.at(i).at(0);
    }
  } else {
    x = -1;
  }
  cout << x << endl;
  return 0;
}
