#include <bits/stdc++.h>
using namespace std;
bool possible(const int m, const int s) { return s >= 0 && s <= 9 * m; }
void largest(int m, int s) {
  if (m == 1 && s == 0) {
    cout << "0";
    return;
  }
  for (int c = 9; c >= 1; --c) {
    if (possible(m - 1, s - c)) {
      putchar('0' + c);
      m -= 1;
      s -= c;
      while (m) {
        for (int c = 9; c >= 0; --c) {
          if (possible(m - 1, s - c)) {
            putchar('0' + c);
            m -= 1;
            s -= c;
            break;
          }
        }
      }
      return;
    }
  }
  cout << "-1";
}
void smallest(int m, int s) {
  if (m == 1 && s == 0) {
    cout << "0";
    return;
  }
  for (int c = 1; c <= 9; ++c) {
    if (possible(m - 1, s - c)) {
      putchar('0' + c);
      m -= 1;
      s -= c;
      while (m) {
        for (int c = 0; c <= 9; ++c) {
          if (possible(m - 1, s - c)) {
            putchar('0' + c);
            m -= 1;
            s -= c;
            break;
          }
        }
      }
      return;
    }
  }
  cout << "-1";
}
void run() {
  int m, s;
  cin >> m >> s;
  smallest(m, s);
  cout << ' ';
  largest(m, s);
  cout << endl;
}
int main() {
  run();
  return 0;
}
