#include <bits/stdc++.h>
using namespace std;
int m, s;
vector<int> v, a;
int main() {
  cin >> m >> s;
  int i = 1, j;
  if ((s == 0 && m != 1) || m * 9 < s) {
    cout << "-1 -1";
    return 0;
  } else if (s == 1) {
    for (i = 0; i < 2; i++) {
      cout << 1;
      for (j = 1; j < m; j++) cout << 0;
      cout << " ";
    }
    return 0;
  } else if (s == 0 && m == 1) {
    cout << "0 0";
    return 0;
  }
  while (i <= m) {
    if (s >= 9) {
      v.push_back(9);
      a.push_back(9);
      s -= 9;
    } else {
      v.push_back(s);
      a.push_back(s);
      s = 0;
    }
    i++;
  }
  for (i = 0; i < v.size(); i++) a[i] = v[i];
  if (v[v.size() - 1] == 0 && v[v.size() - 2] != 0) {
    v[v.size() - 1]++;
    v[v.size() - 2]--;
  } else if (v[v.size() - 1] == 0 && v[v.size() - 2] == 0) {
    for (i = 1; i < v.size(); i++)
      if (v[i] == 0 && v[i - 1] != 0 && v[i + 1] == 0) {
        v[i - 1]--;
        break;
      }
    v[v.size() - 1]++;
  }
  for (i = v.size() - 1; i >= 0; i--) cout << v[i];
  cout << " ";
  for (i = 0; i < a.size(); i++) cout << a[i];
}
