#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, s;
  cin >> m >> s;
  if (s > (9 * m) || s == 0) {
    if (m == 1 && s == 0) {
      cout << 0 << " " << 0;
    } else
      cout << -1 << " " << -1;
    return 0;
  }
  int arr[m];
  for (int i = 0; i < m; i++) {
    arr[i] = 0;
  }
  int arr1[m];
  for (int i = 0; i < m; i++) {
    arr1[i] = 0;
  }
  int p = s;
  for (int i = m - 1; i >= 0; i--) {
    if ((s) > 9) {
      arr[i] = 9;
      s -= 9;
    } else {
      if (s > 1 && i != 0) {
        arr[i] = s - 1;
        arr[0] = 1;
        break;
      } else {
        arr[0] = s;
        break;
      }
    }
  }
  s = p;
  for (int i = 0; i < m; i++) {
    if ((s) >= 9) {
      arr1[i] = 9;
      s -= 9;
    } else {
      arr1[i] = s;
      break;
    }
  }
  for (int i = 0; i < m; i++) cout << arr[i];
  cout << " ";
  for (int i = 0; i < m; i++) cout << arr1[i];
  return 0;
}
