#include <bits/stdc++.h>
using namespace std;
string s, t;
long long ans;
int cnt;
int main() {
  int n, m;
  cin >> n >> m;
  if (m == 0 && n != 1 || n * 9 < m) {
    cout << "-1"
         << " "
         << "-1";
    return 0;
  }
  if (m == 0 && n == 1) {
    cout << 0 << " " << 0;
    return 0;
  }
  while (ans + 9 < m) {
    s += '9';
    ans += 9;
  }
  ans = m - ans;
  for (int i = 1; n >= i; i++) {
    for (int j = 0; 9 >= j; j++) {
      if ((m - j - cnt) <= (n - i) * 9) {
        if (i == 1 && j == 0) continue;
        cnt += j;
        cout << j;
        break;
      }
    }
  }
  cout << " ";
  for (int i = 0; n > i; i++) {
    if (s.size() < i)
      cout << 0;
    else if (s.size() == i)
      cout << ans;
    else
      cout << s[i];
  }
  return 0;
}
