#include <bits/stdc++.h>
char local = 'O';
using namespace std;
int main() {
  long long n, s;
  cin >> n >> s;
  string minn = "", maxx = "";
  if (n == 1 && s == 0)
    cout << "0 0\n";
  else if (s > 9 * n || s == 0)
    cout << "-1 -1\n";
  else {
    long long s1 = s;
    while (s1 > 0) {
      if (s1 >= 9)
        maxx += "9";
      else {
        maxx += s1 + '0';
      }
      s1 -= 9;
    }
    while (maxx.size() < n) maxx += "0";
    s1 = s;
    while (1) {
      if (s1 > 9)
        minn = "9" + minn;
      else {
        break;
      }
      s1 -= 9;
    }
    if (minn.size() <= n - 2) {
      minn = to_string(s1 - 1) + minn;
      while (minn.size() < n - 1) minn = "0" + minn;
      minn = "1" + minn;
    } else
      minn = to_string(s1) + minn;
    cout << minn << " " << maxx << "\n";
  }
  return 0;
}
