#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, s;
  cin >> m >> s;
  if (s >= 1 && s <= 9 * m) {
    vector<int> a(m);
    int s1 = s;
    int i = 0;
    while (s1 >= 9) {
      a[i] = 9;
      s1 = s1 - 9;
      i++;
    }
    if (i < m) {
      a[i] = s1;
      i++;
      while (i < m) {
        a[i] = 0;
        i++;
      }
    }
    vector<int> b(m);
    for (int j = 0; j < m; j++) {
      b[j] = a[j];
    }
    if (a[m - 1] == 0) {
      int j = m - 1;
      while (a[j] == 0) {
        j--;
      }
      a[m - 1] = 1;
      a[j] = a[j] - 1;
    }
    for (int j = m - 1; j >= 0; j--) {
      cout << a[j];
    }
    cout << " ";
    for (int i = 0; i < m; i++) {
      cout << b[i];
    }
    cout << endl;
  } else if (m == 1 && s == 0) {
    cout << "0 0" << endl;
  } else {
    cout << -1 << " " << -1 << endl;
  }
  return 0;
}
