#include <bits/stdc++.h>
using namespace std;
void split(const string &s, vector<string> &tokens, char delimiter) {
  string token;
  istringstream tokenStream(s);
  while (getline(tokenStream, token, delimiter)) tokens.push_back(token);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int m, s, f, temp;
  cin >> m >> s;
  string sm, bg;
  if (!s) {
    if (m == 1)
      cout << "0 0";
    else
      cout << "-1 -1";
    return 0;
  }
  temp = s;
  for (register int i = (0); i < (m); i += (1)) {
    f = 0;
    for (register int j = ((i ? 0 : 1)); j < (10); j += (1)) {
      if (ceil((temp - j) * 1.0 / 9) <= m - i - 1) {
        sm.push_back(char('0' + j));
        temp -= j;
        f = 1;
        break;
      }
    }
    if (!f) break;
  }
  temp = s;
  for (register int i = (0); i < (m); i += (1)) {
    f = 0;
    for (register int j = (9); j > ((i ? -1 : 0)); j -= (1)) {
      if (j <= temp) {
        bg.push_back(char('0' + j));
        temp -= j;
        f = 1;
        break;
      }
    }
    if (!f) break;
  }
  if (sm.length() != m || bg.length() != m)
    cout << "-1 -1";
  else
    cout << sm << " " << bg;
  return 0;
}
