
    Given a sequence of n consecutive vital sign measurements from a patient's wearable device, determine the number of distinct ways these readings can be arranged such that exactly m peaks occur, where a peak is defined as a reading that is greater than both its adjacent measurements. This pattern analysis is crucial for identifying potential health anomalies and early disease detection.
    

    
def eulerian_num(n, m):
    """
    Given a sequence of n consecutive vital sign measurements from a patient's wearable device, determine the number of distinct ways these readings can be arranged such that exactly m peaks occur, where a peak is defined as a reading that is greater than both its adjacent measurements. This pattern analysis is crucial for identifying potential health anomalies and early disease detection.
    

    """
def eulerian_num(n, m):
    """
    Given a sequence of n consecutive vital sign measurements from a patient's wearable device, determine the number of distinct ways these readings can be arranged such that exactly m peaks occur, where a peak is defined as a reading that is greater than both its adjacent measurements. This pattern analysis is crucial for identifying potential health anomalies and early disease detection.
    

    """
    if m >= n or n == 0:
        return 0
    if m == 0:
        return 1
    return (n - m) * eulerian_num(n - 1, m - 1) + (m + 1) * eulerian_num(n - 1, m)