#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, s, i;
  int temp;
  int *c;
  cin >> m >> s;
  temp = s;
  if (s > m * 9 || s < 0 || (s == 0 && m > 1))
    cout << "-1 -1";
  else {
    c = new int[m];
    for (i = m - 1; s > 9; i--) {
      c[i] = 9;
      s -= 9;
    }
    c[i] = s;
    if (i > 0) {
      c[i--]--;
      while (i > 0) c[i--] = 0;
      c[i] = 1;
    }
    i = 0;
    while (i < m) cout << c[i++];
    cout << ' ';
    i = 0;
    s = temp;
    while (s > 9) {
      c[i++] = 9;
      s -= 9;
    }
    c[i++] = s;
    while (i < m) c[i++] = 0;
    i = 0;
    while (i < m) cout << c[i++];
  }
  return 0;
}
