#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, s, i, j, k, t, s1, m1, t1 = 1;
  cin >> m >> s;
  s1 = s;
  m1 = m;
  t = m * 9;
  if (s == 0 && m == 1)
    cout << "0 0" << endl;
  else if (s == 0 && m > 1)
    cout << "-1 -1" << endl;
  else if (s > t)
    cout << "-1 -1" << endl;
  else if (s == t && m == 1)
    cout << s << " " << s << endl;
  else {
    i = 9 * (m - 1);
    if (i <= (s - 1)) {
      i = s % 9;
      if (i) {
        cout << i;
        m = m - 1;
        s = s - i;
      }
    } else {
      cout << "1";
      s = s - 1;
      m = m - 1;
    }
    if (s % 9)
      k = s / 9 + 1;
    else
      k = s / 9;
    j = m - k;
    while (j--) {
      cout << "0";
      m = m - 1;
    }
    j = s % 9;
    if (j) {
      cout << j;
      m = m - 1;
    }
    while (m--) cout << "9";
    cout << " ";
    j = s1 / 9;
    m1 = m1 - j;
    while (j--) cout << "9";
    k = s1 % 9;
    if (k) {
      cout << k;
      m1 = m1 - 1;
    }
    while (m1--) cout << "0";
    cout << endl;
  }
  return 0;
}
