#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int m, s;
  cin >> m >> s;
  if (s > m * 9 || m > 1 && s < 1)
    cout << "-1 -1";
  else {
    int a = s, b = s, index = m - 1;
    while (index >= 0) {
      int pos;
      pos = max(0, a - 9 * index);
      if (index == m - 1 && a && pos == 0) pos = 1;
      cout << pos;
      index--;
      a -= pos;
    }
    cout << ' ';
    index = m;
    while (index != 0) {
      int pos;
      pos = min(9, b);
      cout << pos;
      index--;
      b -= pos;
    }
  }
  return 0;
}
