#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int INF = 1e9;
const double EPS = 1e-10;
const double PI = acosl(-1);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, s, fs;
  cin >> n >> s;
  fs = s;
  string mn = "", mx = "";
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    while (fs - cnt > 0 && cnt < 9) {
      cnt++;
    }
    if (fs - cnt == 0 && i < n - 1)
      if (n > 1 && cnt) {
        mn += to_string(cnt - 1);
        mn += "1";
        i++;
        ;
      } else
        mn += to_string(cnt);
    else
      mn += to_string(cnt);
    fs -= cnt;
  }
  sort(mn.begin(), mn.end());
  for (int i = 1; i < n * (mn[0] == '0'); i++) {
    if (mn[i] != '0') {
      swap(mn[i], mn[0]);
      break;
    }
  }
  fs = s;
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    while (fs - cnt > 0 && cnt < 9) {
      cnt++;
    }
    fs -= cnt;
    mx += to_string(cnt);
  }
  sort(mx.begin(), mx.end());
  reverse(mx.begin(), mx.end());
  if ((mx[0] == '0' && mx.size() > 1) || (mn[0] == '0' && mn.size() > 1) ||
      n * 9 < s)
    cout << "-1 -1";
  else
    cout << mn << ' ' << mx;
  return 0;
}
