#include <bits/stdc++.h>
using namespace std;
string Min = "", Max = "";
long long int n, t;
bool can(long long int num, long long int s) {
  if (s >= 0 && num == 0 && num == s) return true;
  return s >= 0 && s <= (9 * num);
}
void solve() {
  cin >> n >> t;
  if (n == 1 && t == 0) {
    cout << 0 << " " << 0;
    return;
  }
  long long int k = t;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < 10; j++) {
      if (i == 0 && j == 0) continue;
      if (can(n - i - 1, t - j)) {
        char number = '0' + j;
        Min += number;
        t -= j;
        break;
      }
    }
  }
  if (Min.size() != n) {
    cout << -1 << " " << -1;
    return;
  }
  t = k;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 9; j >= 0; j--) {
      if (i == 0 && j == 0) continue;
      if (can(n - i - 1, t - j)) {
        cerr << i << " " << j << "\n";
        char number = '0' + j;
        Max += number;
        t -= j;
        break;
      }
    }
  }
  cout << Min << " " << Max;
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  solve();
  return 0;
}
