#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int m, s, digits[200], sum, a[200];
  cin >> m >> s;
  sum = s;
  if (s == 0 && m == 1) {
    cout << "0 0";
    return 0;
  }
  if (s == 0 || s > (m * 9)) {
    for (long long int i = 0; i < 2; i++) {
      cout << "-1 ";
    }
    return 0;
  }
  for (long long int i = 0; i < m; i++) {
    if (sum == 0) digits[i] = 0;
    if (sum >= 9) {
      digits[i] = 9;
      sum -= 9;
    } else {
      digits[i] = sum;
      sum = 0;
    }
  }
  for (long long int i = 0; i < m; i++) {
    a[i] = digits[i];
  }
  for (long long int i = 0; i < m; i++) {
    digits[i] = 0;
  }
  sum = s - 1;
  digits[0] = 1;
  for (long long int i = m - 1; i >= 0; i--) {
    if (sum >= 9) {
      digits[i] = 9;
      sum -= 9;
    } else {
      digits[i] += sum;
      sum = 0;
    }
  }
  for (long long int i = 0; i < m; i++) cout << digits[i];
  cout << " ";
  for (long long int i = 0; i < m; i++) cout << a[i];
  return 0;
}
