#include <bits/stdc++.h>
using namespace std;
int m, s;
int ans1[110], ans2[110], a1, a2;
int main() {
  cin >> m >> s;
  int tmp = s;
  for (int i = m; i > 0; i--) {
    if (tmp > 9)
      ans1[i] = 9, tmp -= 9;
    else {
      if (i == 1)
        ans1[i] = tmp;
      else {
        if (tmp > 1)
          ans1[1] = 1, ans1[i] = tmp - 1;
        else
          ans1[1] = 1;
      }
      tmp = 0;
      break;
    }
  }
  if (tmp > 0 || (s == 0 && m > 1)) {
    cout << "-1 -1" << endl;
    return 0;
  }
  tmp = s;
  for (int i = 1; i <= m; i++) {
    if (tmp > 9)
      ans2[i] = 9, tmp -= 9;
    else if (tmp > 0)
      ans2[i] = tmp, tmp = 0;
    else
      break;
  }
  for (int i = 1; i <= m; i++) cout << ans1[i];
  cout << " ";
  for (int i = 1; i <= m; i++) cout << ans2[i];
  cout << endl;
  return 0;
}
