#include <bits/stdc++.h>
using namespace std;
void fastio() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
const double PI = 3.14159265358979323846264338327;
void one();
int main() {
  fastio();
  int t = 1;
  for (int i = 0; i < t; ++i) {
    one();
  }
  return 0;
}
void one() {
  int m, s;
  cin >> m >> s;
  int s2 = s;
  if (s > m * 9 || (s == 0 && m != 1)) {
    cout << "-1 -1" << endl;
    return;
  }
  string ss;
  for (int i = 0; i < m; ++i) ss += '0';
  {
    if (s > 0) {
      if ((m - 1) * 9 >= s) {
        ss[0] = '1';
        s -= 1;
      }
    }
    int i = m - 1;
    while (s > 0) {
      int x = min(9, s);
      ss[i--] = '0' + x;
      s -= x;
    }
    cout << ss << " ";
  }
  {
    for (int i = 0; i < m; ++i) {
      int x = min(9, s2);
      cout << x;
      s2 -= x;
    }
  }
}
