#include <bits/stdc++.h>
using namespace std;
string Max(int n, int s) {
  string str = "";
  while (s >= 9 && n > 0) {
    str += '9';
    s -= 9;
    n--;
  }
  if (n == 0 && s > 0) return "-1";
  if (n > 0) {
    str += char(s + 48);
    for (int i = 1; i < n; i++) str += '0';
  }
  return str;
}
int main() {
  int n, s;
  string str = "";
  cin >> n >> s;
  if (n * 9 < s)
    cout << "-1 -1";
  else if (n > 1 and s == 0)
    cout << "-1 -1";
  else if (s == 1) {
    cout << 1;
    for (int i = 1; i < n; i++) cout << 0;
    cout << " 1";
    for (int i = 1; i < n; i++) cout << 0;
  } else {
    for (int i = Max(n, s).size() - 1; i >= 0; i--) str += Max(n, s)[i];
    if (str[0] == '0' and str.size() > 1) {
      str[0] = '1';
      for (int i = 1; i < str.size(); i++)
        if (str[i] > '0') {
          str[i] = char(int(str[i]) - 1);
          break;
        }
    }
    cout << str << " " << Max(n, s);
  }
}
