#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, s;
  while (~scanf("%d%d", &m, &s)) {
    if (m == 1 && s == 0)
      printf("0 0\n");
    else if (s == 0 || (m * 9 < s))
      printf("-1 -1\n");
    else {
      int num[111], pos = 0;
      while (pos < m) {
        if (s > 9)
          num[pos] = 9, s -= 9;
        else
          num[pos] = s, s = 0;
        pos++;
      }
      bool flag = true;
      for (int i = m - 1; i >= 0; i--) {
        if (num[i] == 0 && flag)
          printf("1"), flag = false;
        else if (num[i] != 0 && (!flag))
          printf("%d", num[i] - 1), flag = true;
        else
          printf("%d", num[i]);
      }
      printf(" ");
      for (int i = 0; i < m; i++) printf("%d", num[i]);
      printf("\n");
    }
  }
  return 0;
}
