#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, i, j;
  cin >> a >> b;
  c = b;
  string s = "";
  for (i = 1; i <= a - 1; i++) {
    if (b > 9) {
      s += "9";
      b -= 9;
    } else if (b <= 9 && b > 1) {
      s += (b - 1) + 48;
      b = 1;
    } else if (b == 1)
      s += "0";
  }
  if (b > 9 || b == 0 && a != 1) {
    cout << "-1 -1" << endl;
    return 0;
  }
  int bre = 0;
  s += char(b + 48);
  string s1 = "";
  for (i = 1; i <= a; i++) {
    if (c >= 9) {
      s1 += "9";
      c -= 9;
    } else if (c < 9) {
      s1 += char(c + 48);
      c = 0;
    } else
      s1 += "0";
  }
  for (i = s.size() - 1; i >= 0; i--) cout << s[i];
  cout << " ";
  cout << s1 << endl;
}
