#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, S;
  cin >> N >> S;
  if (N == 1 && S == 0) {
    cout << "0 0" << endl;
    return 0;
  } else if ((N > 1 && S == 0) || (S > N * 9)) {
    cout << "-1 -1" << endl;
    return 0;
  }
  vector<int> mn(N, 0);
  vector<int> mx(N, 9);
  int ssum = 1, lsum = N * 9;
  mn[0] = 1;
  int yet = N - 1;
  while (yet >= 0 && ssum != S) {
    mn[yet]++;
    if (mn[yet] == 9) yet--;
    ssum++;
  }
  if (ssum != S)
    cout << "-1 ";
  else {
    for (int i = 0; i < mn.size(); ++i) cout << mn[i];
    cout << "\n";
  }
  yet = N - 1;
  while (yet >= 0 && lsum != S) {
    if (yet == 0 && mx[yet] < 2) break;
    mx[yet]--;
    if (mx[yet] == 0) yet--;
    lsum--;
  }
  if (lsum != S)
    cout << "-1 ";
  else {
    for (int i = 0; i < mx.size(); ++i) cout << mx[i];
    cout << "\n";
  }
  return 0;
}
