#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int m, n;
  cin >> m >> n;
  int n2 = n;
  if (n > 9 * m || (n == 0 && m > 1) || n < 0) {
    cout << "-1 -1";
    return 0;
  } else if (m == 1 && n == 0) {
    cout << "0 0";
    return 0;
  } else {
    int an[m];
    int bn[m];
    for (int i = 0; i < m; ++i) {
      if (n > 9) {
        an[i] = 9;
      } else {
        an[i] = n;
      }
      n -= an[i];
    }
    for (int i = 0; i < m; ++i) {
      if (i == 0 && n2 - 1 <= (9 * (m - 1))) {
        bn[i] = 1;
      } else {
        if (n2 <= ((m - 1 - i) * 9)) {
          bn[i] = 0;
        } else {
          bn[i] = n2 - ((m - 1 - i) * 9);
        }
      }
      n2 -= bn[i];
    }
    for (int i = 0; i < m; ++i) {
      cout << bn[i];
    }
    cout << " ";
    for (int i = 0; i < m; ++i) {
      cout << an[i];
    }
  }
  return 0;
}
