from typing import List


def count_table_entries(x: int, table: List[List[int]]) -> int:
    """
    Given a table, count the number of occurrences of x in it.
    :param x: the element to find
    :param table: the table to search
    :return: the number of occurrences of x

    >>> count_table_entries(1, [[1, 1, 1], [1, 1, 1], [1, 1, 1]])
    9

    >>> count_table_entries(2, [[2, 0, 0], [0, 2, 0], [0, 0, 3]])
    2

    >>> count_table_entries(0, [[1, 2], [3, 4]])
    0
    """
    return sum(row.count(x) for row in table)