#include <bits/stdc++.h>
using namespace std;
string getMax(int m, int s) {
  string d;
  if (m != 0) {
    d = (char)(min(9, s) + '0') + getMax(m - 1, s - min(9, s));
  }
  return d;
}
string getMin(int m, int s) {
  string d;
  if (m != 0) {
    d = (char)(max(0, s - (m - 1) * 9) + '0') +
        getMin(m - 1, s - max(0, s - (m - 1) * 9));
  }
  return d;
}
int main() {
  int m, s;
  cin >> m >> s;
  if (m * 9 < s) {
    cout << -1 << " " << -1 << "\n";
    return 0;
  }
  if (s == 0) {
    if (m > 1) cout << -1 << " " << -1 << "\n";
    if (m == 1) cout << 0 << " " << 0 << "\n";
    return 0;
  }
  char r = (s > (m - 1) * 9) ? s - (m - 1) * 9 + '0' : '1';
  cout << r + getMin(m - 1, s - (r - '0')) << " " << getMax(m, s) << "\n";
}
