#include <bits/stdc++.h>
using namespace std;
bool fdp[902][102];
bool dp[902][102];
bool rec(int s, int m) { return s >= 0 && s <= 9 * m; }
int main() {
  int M, S;
  cin >> M >> S;
  int f = 0;
  int Sx = S, Sn = S;
  string ans_mx, ans_mn;
  for (int i = 1; i <= M; ++i) {
    int mx = -1;
    int mn = 10;
    for (int j = 0; j <= 9; ++j) {
      if (j == 0 and i == 1 and M != 1) continue;
      if (Sx - j >= 0 and rec(Sx - j, M - i)) f = 1, mx = max(mx, j);
      if (Sn - j >= 0 and rec(Sn - j, M - i)) f = 1, mn = min(mn, j);
    }
    if (i == 1 and f == 0) {
      cout << "-1 -1";
      return 0;
    }
    Sx -= mx;
    Sn -= mn;
    ans_mx += (char)('0' + mx);
    ans_mn += (char)('0' + mn);
  }
  cout << ans_mn << ' ' << ans_mx;
}
