#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m, s;
  string x, y;
  cin >> m >> s;
  if (s == 0) {
    cout << (m == 1 ? "0 0" : "-1 -1");
    return 0;
  }
  int t;
  for (i = 0; i < m; i++) {
    t = min(s, 9);
    y += t + '0';
    s -= t;
  }
  if (s > 0) {
    cout << -1 << " " << -1;
    return 0;
  }
  for (i = m - 1; i >= 0; i--) {
    x += y[i];
  }
  if (x[0] == '0') {
    x[0] = '1';
    int ll = x.length();
    for (int j = 1; j < ll; j++) {
      if (x[j] != '0') {
        x[j]--;
        break;
      }
    }
  }
  cout << x << " " << y;
}
