#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
const long long loo = 1e18;
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
int main() {
  int m, s;
  cin >> m >> s;
  if ((s == 0 && m > 1) || s > m * 9) {
    cout << "-1 -1\n";
    return 0;
  }
  if (s == 0 && m == 1) {
    cout << "0 0\n";
    return 0;
  }
  vector<int> a(m, 0);
  int x = s - 1;
  a[0] = 1;
  int i = m - 1;
  while (x > 0 && i > 0) {
    if (x <= 9) {
      a[i] += x;
      x = 0;
    } else {
      a[i] += 9;
      x -= 9;
    }
    i--;
  }
  if (x > 0) {
    a[0] += x;
    x = 0;
  }
  for (int i = 0; i < m; i++) {
    cout << a[i];
  }
  cout << " ";
  a.clear();
  a.resize(m, 0);
  i = 0;
  x = s;
  while (x > 0) {
    if (x <= 9) {
      a[i] += x;
      x = 0;
    } else {
      a[i] += 9;
      x -= 9;
    }
    i++;
  }
  for (int i = 0; i < m; i++) {
    cout << a[i];
  }
  cout << endl;
  return 0;
}
