#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  int num[a], num2[a];
  int l = 9, h = 9, p = 0, b2, i = a - 1;
  b2 = b - 1;
  int b1 = b;
  for (int s = 0; s < a; s++) num[s] = 0;
  for (int ssss = 0; ssss < a; ssss++) num2[ssss] = 0;
  if ((b <= a * 9) && (b > 0 && a > 0)) {
    while (b2 > 0) {
      if (b2 >= l) {
        b2 -= l;
        num[i] = l;
        i--;
      } else if (b2 < l) {
        l--;
      }
    }
    while (b1 > 0) {
      if (b1 >= h) {
        b1 -= h;
        num2[p] = h;
        p++;
      } else if (b1 < h) {
        h--;
      }
    }
    num[0] += 1;
    for (int ss = 0; ss < a; ss++) {
      cout << num[ss];
    }
    cout << endl;
    for (int sss = 0; sss < a; sss++) {
      cout << num2[sss];
    }
  } else if (a == 1 && b == 0)
    cout << "0 0";
  else
    cout << "-1 -1";
}
