#include <bits/stdc++.h>
using namespace std;
char str1[100 + 10], str2[100 + 10];
int main() {
  int m, s;
  while (~scanf("%d%d", &m, &s)) {
    for (int i = 0; i < m; i++) str1[i] = str2[i] = '0';
    int ss = s;
    if (m == 1 && s == 0) {
      printf("0 0\n");
      continue;
    }
    if (s == 0 || s > m * 9) {
      printf("-1 -1\n");
      continue;
    }
    for (int i = 0; i < m; i++) {
      if (ss > 9) {
        str1[i] = '9';
        ss -= 9;
      } else {
        str1[i] = ss + '0';
        ss -= ss;
      }
    }
    ss = s;
    for (int i = m - 1; i >= 0; i--) {
      if (ss > 9) {
        str2[i] = '9';
        ss -= 9;
      } else {
        if (i == 0) {
          str2[i] = '0' + ss;
          ss -= ss;
        } else {
          str2[i] = '0' + ss - 1;
          ss -= ss - 1;
          str2[0] = '1';
          break;
        }
      }
    }
    str1[m] = str2[m] = '\0';
    printf("%s %s\n", str2, str1);
  }
  return 0;
}
