#include <bits/stdc++.h>
int main() {
  int m, s, c, i;
  std::cin >> m >> s;
  c = s;
  if (m == 1 && c == 0)
    std::cout << 0 << " " << 0;
  else {
    if (c == 0 || c > (9 * m)) {
      std::cout << -1 << " " << -1;
    } else {
      for (i = m; i > 0; i--) {
        if (c <= 9 * (i - 1)) {
          if (i == m) {
            std::cout << 1;
            c--;
          } else
            std::cout << 0;
        } else {
          std::cout << (c - 9 * (i - 1));
          c = 9 * (i - 1);
        }
      }
      std::cout << " ";
      c = s;
      for (i = m - 1; i >= 0; i--) {
        if (c <= 9) {
          std::cout << c;
          c = 0;
        } else {
          std::cout << 9;
          c = c - 9;
        }
      }
    }
  }
  return 0;
}
