#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int N = 1e2 + 5;
const int mod = 1e9 + 7;
int m, s;
int a[N];
int main() {
  cin >> m >> s;
  if (s == 0 && m == 1) {
    puts("0 0");
    return 0;
  }
  if (s == 0 || 9 * m < s) {
    puts("-1 -1");
    return 0;
  }
  int l = 0;
  int t = s;
  while (t) {
    if (t > 9) {
      a[l++] = 9;
      t -= 9;
    } else {
      a[l++] = t;
      t = 0;
    }
  }
  if (l != m) {
    a[l - 1]--;
    a[m - 1] = 1;
  }
  for (int i = m - 1; i >= 0; i--) {
    cout << a[i];
    a[i] = 0;
  }
  t = s;
  l = m - 1;
  while (t) {
    if (t > 9) {
      a[l--] = 9;
      t -= 9;
    } else {
      a[l--] = t;
      t = 0;
    }
  }
  putchar(' ');
  for (int i = m - 1; i >= 0; i--) {
    cout << a[i];
    a[i] = 0;
  }
  return 0;
}
